<template>
	<view class="content">
        <u-navbar :fixed="true" :shadow="true" :safeAreaInsetTop="true" :placeholder="true"
            @leftClick="back" :title="title" >
        </u-navbar>

        <view class="uni-area">
            <!-- 新增班组 -->
            <uni-item-base-plus v-if="type=='team'" class="u-m-t-50" :baseData="teamInfo" />

            <!-- 人员离场 -->
            <view v-if="type=='leave'">
                <view class="u-m-t-50 u-font-32 font-bold">人员信息</view>
                <uni-leave class="u-m-t-20" v-for="(item,index) in leave.staffs" :key="index" :staffItem="item" />
                <view class="u-m-t-50 u-font-32 font-bold">离场时间</view>
                <u--input class="u-m-t-30 u-m-l-20" disabled fontSize="28rpx"
                    prefixIcon="calendar" prefixIconStyle="font-size:48rpx;color:#909399"
                    v-model="leave.lcsj">
                </u--input>
                <view class="u-m-t-50 u-font-32 font-bold">离场原因</view>
                <u--textarea class="u-m-t-30" v-model="leave.sgxkbh" disabled :autoHeight="true"
                    style="background:#f5f7fa" placeholder="请填写审批意见" placeholderClass="uni-placeholder">
                </u--textarea>
            </view>

            <!-- 人员调岗 -->
            <view v-if="type=='transfer'">
                <view class="u-m-t-50 u-font-32 font-bold">调岗班组</view>
                <uni-item-team class="u-m-t-30" :listItem="transfer.teamData" />
                <view class="u-m-t-50 u-font-32 font-bold">人员信息</view>
                <view class="u-m-t-30 uni-shadow u-p-t-10" style="background:#fff" 
                    v-for="(tem,ind) in transfer.staffList" :key="ind">
                    <u-row customStyle="flex-wrap:wrap">
                        <u-col v-for="(item,index) in tem" :key="index" :span="item.span"
                            class="u-m-t-20 u-font-26" style="flex-direction:row">
                            <text class="u-m-r-14 uni-dec-color">{{item.title}}</text>
                            <text v-if="item.field=='_status'" :style="{color:item.value=='已变更'?'#dd524d':'#4cd964'}">{{item.value}}</text>
                            <text v-else class="u-line-1">{{item.value}}</text>
                        </u-col>
                    </u-row>
                </view>
                <view class="u-m-t-50 u-font-32 font-bold">调岗原因</view>
                <u--textarea class="u-m-t-30" v-model="transfer.reason" disabled :autoHeight="true"
                    style="background:#f5f7fa" placeholder="调岗原因" placeholderClass="uni-placeholder">
                </u--textarea>
            </view>

            <!-- 班组长变更审核 -->
            <view v-if="type=='foreman'">
                <!-- 基本信息 -->
                <view class="u-m-t-50 u-font-32 font-bold">班组基本信息</view>
                <uni-item-team class="u-m-t-20" :listItem="foreman.baseInfo"></uni-item-team>
                <!-- 班组长变更信息 -->
                <view class="u-m-t-50 u-font-32 font-bold">班组长变更信息</view>
                <uni-leave class="u-m-t-20" :staffItem="foreman.changeInfo"> </uni-leave>

                <!-- 变更原因 -->
                <view class="u-m-t-50 u-font-32 font-bold">变更原因</view>
                <u--textarea class="u-m-t-30" v-model="foreman.bz" disabled :autoHeight="true"
                    style="background:#f5f7fa" placeholder="请填写审批意见" placeholderClass="uni-placeholder">
                </u--textarea>
            </view>


            <!-- 实名制审核 -->
            <view v-if="type=='autonym'">
                <!-- 实名制信息 -->
                <uni-item-base-plus class="u-m-t-50" :baseData="autonym.info" />
                <!-- 合同信息 -->
                <uni-item-base-plus class="u-m-t-50" :baseData="autonym.contractInfo" />
                <!-- 工资卡信息 -->
                <uni-item-base-plus class="u-m-t-50" :baseData="autonym.paycardInfo" />
                <!-- 其它信息 -->
                <uni-item-base-plus class="u-m-t-50" :baseData="autonym.otherInfo" />
            </view>

            <!-- 进场 -->
            <view v-if="type=='enter'">
                <view class="u-m-t-50 u-font-32 font-bold">进场时间</view>
                <u--input class="u-m-t-20 u-m-l-20" disabled fontSize="28rpx"
                    prefixIcon="calendar" prefixIconStyle="font-size:48rpx;color:#909399"
                    v-model="enter.enterTime">
                </u--input>
                <view class="u-m-t-50 u-font-32 font-bold">人员信息</view>
                <u-row class="u-flex u-flex-wrap u-m-t-20 uni-shadow u-p-t-10" v-for="(tem,ind) in enter.staffs" :key="ind">
                    <u-col class="u-m-t-20 u-font-26" style="flex-direction:row" v-for="(item,index) in tem" :key="index" :span="item.span">
                        <text class="u-m-r-20 u-line-1 uni-dec-color">{{item.title}}</text>
                        <uni-phone v-if="item.type=='phone'" :phone="item.value" size="13"/>
                        <text v-else class="u-line-1" :style="{maxWidth:item.span==12?'78%':'70%'}">{{item.value}}</text>
                    </u-col>
                </u-row>
            </view>


            <!-- 补卡 -->
            <view v-if="type=='buka'">
                <view class="u-m-t-50 u-font-32 font-bold">人员信息</view>
                <uni-item-member-plus v-if="buka.memberInfo" class="u-m-t-30" :listItem="buka.memberInfo"/>
                <!-- 补卡时间理由 -->
                <view class="u-m-t-30 uni-shadow">
                    <view class="u-flex u-row-between u-font-28">
                        <text class="uni-dec-color">补卡时间</text>
                        <text>{{buka.time}}</text>
                    </view>
                    <u-line class="u-m-t-20" color="#eee"></u-line>
                    <view class="u-m-t-20 u-font-28 uni-dec-color">补卡理由</view>
                    <u--textarea class="u-m-t-20" v-model="buka.reason" disabled :autoHeight="true"
                        placeholder="补卡理由" placeholderClass="uni-placeholder">
                    </u--textarea>
                </view>
            </view>


            <!-- 审批 -->
            <view v-if="status==0" class="u-m-t-50 uni-shadow">
                <view class="u-font-30 font-bold">审批意见</view>
                <u--textarea class="u-m-t-20" v-model="reason" :autoHeight="true"
                    style="background:#f5f7fa" placeholder="请填写审批意见" placeholderClass="uni-placeholder">
                </u--textarea>
            </view>


            <!-- 审核结果 -->
            <uni-item-base v-if="status==1" class="u-m-t-50" :baseData="result"/>


            <!-- 附件 -->
            <uni-accessory class="u-m-t-50" v-if="type!='buka'" 
                :accessorys="accessoryList" :upload="false" :title="{title:'附件'}" />


            <!-- 间隙 -->
            <u-gap v-if="status==0" class="u-m-t-30" height="182rpx" bgColor="#FBFCFC"></u-gap>
            <u-gap v-if="status==1" class="u-m-t-30" height="2" bgColor="#FBFCFC"></u-gap>
        </view>


        <!-- 底部操作 -->
        <view v-if="status==0" class="uni-bottom u-flex u-row-between">
            <u-button class="btn1" text="取消" @tap="btnFn(2)"></u-button>
            <u-button class="btn1" type="primary" text="通过" @tap="btnFn(1)"></u-button>
            <u-button class="btn1" type="error" text="拒绝" @tap="btnFn(0)"></u-button>
        </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
                userInfo: uni.getStorageSync('userInfo'),
                status: 0, // 0:待审核 1:已审核
                type: 'team', // 类型
                id: null, // 业务Id

                title: '工人信息采集',

                detailApi: null, // 详情api
                auditApi: null, // 审核api

                // 新增班组
                teamInfo:{
                    line: false,
                    title: '班组信息',
                    rightText: '',
                    list:[
                        { show:true, field:'gcmc', title:'项目名称', value:'' },
                        { show:true, field:'qymc', title:'所属企业', value:'' },
                        { show:true, field:'bzmc', title:'班组名称', value:'', },
                    ]
                },
                // 人员离场
                leave:{
                    staffs: [], // 立场人员
                    lcsj: '', // 离场时间
                    sgxkbh: '我是离场原因',
                    auditPar:{} // 审核所需参数
                },
                // 人员调岗
                transfer:{
                    teamData:{},
                    reason: '暂无字段',
                    staffList: [], // 当前班组下的人员信息
                    staffItem:[
                        { field:'staffname', title:'姓名', span:6, value:'' },
                        { field:'isleader', title:'是否班组长', span:6, value:'' },
                        { field:'idcard', title:'证件号码', span:12, value:'' },
                        { field:'origroupname', title:'原班组', span:6, value:'' },
                        { field:'taggroupname', title:'变更班组', span:6, value:'' },
                        { field:'_status', title:'变更状态', span:6, value:'未变更' },
                    ],
                },
                // 班组长变更审批
                foreman:{
                    baseInfo:{}, // 班组基本信息
                    changeInfo:{}, // 班组长变更信息
                    bz: '我是变更原因'  
                },

                // 实名制
                autonym:{
                    // 实名制信息
                    info:{
                        line: false,
                        title: '实名制信息',
                        rightText: '',
                        list:[
                            { show:true, field:'xm', title:'姓名', value:'安薪乐' },
                            { show:true, field:'zjhm', title:'公民身份证号码', value:'安薪乐' },
                            { show:true, field:'csrq', title:'出生日期', value:'安薪乐' },
                            { show:true, field:'xb', zdv:'xb', title:'性别', value:'安薪乐' },
                            { show:true, field:'mz', zdv:'mz', title:'民族', value:'安薪乐' },
                            { show:true, field:'jiGuan', title:'籍贯', value:'安薪乐' },
                            { show:true, field:'hjszd', title:'住址', value:'安薪乐' },
                            { show:true, field:'qfjg', title:'签发机关', value:'安薪乐' },
                            { show:true, field:'yxksrq', title:'有效期限开始', value:'安薪乐' },
                            { show:true, field:'yxjsrq', title:'有效期限结束', value:'安薪乐' },
                            { show:true, field:'lxfs', title:'手机号码', value:'安薪乐' },
                        ]
                    },
                    // 合同信息
                    contractInfo:{
                        type: 'contractInfo',
                        line: false,
                        title: '合同信息',
                        rightText: '',
                        list:[
                            { show: true, field:'sflwht', zdv:'shifou', title:'是否签署合同', value:'' },
                            { show: true, field:'htlx', zdv:'htlx', title:'合同类型', value:'' },
                            { show: true, field:'htqdsj', zdv:'', title:'合同签订时间', value:'' },
                            { show: true, field:'htqssj', zdv:'', title:'合同起始时间', value:'' },
                            { show: true, field:'htzzsj', zdv:'', title:'合同终止时间', value:'' },
                            { show: true, field:'lwhtbh', zdv:'', title:'合同编号', value:'' },
                            { show: true, field:'gzjsfs', zdv:'jxfs', title:'工资计算方式', value:'' },
                            { show: true, field:'gzbz', zdv:'', title:'工资标准', value:'' },
                            { show: true, field:'gzzfrq', zdv:'', title:'工资支付日期', value:'' }
                        ]
                    },
                    // 工资卡信息
                    paycardInfo:{
                        type: 'paycardInfo',
                        line: false,
                        title: '工资卡信息',
                        rightText: '',
                        list:[
                            { show:true, field:'gzklb', zdv:'gzklb', title:'工资卡类别', value:'' },
                            { show:true, field:'khhyh', zdv:'jyjgbm', title:'工资卡开户银行', value:'', },
                            { show:true, field:'khhdm', zdv:'', title:'开户行行号', value:'' },
                            { show:true, field:'gzkkh', disabled:true, zdv:'', title:'工资卡号', value:'' },
                            { show:false,  field:'sbkkh', zdv:'', title:'社保卡号', value:'' },
                        ]
                    },
                    // 其它信息
                    otherInfo:{
                        type: 'otherInfo',
                        line: false,
                        title: '其它信息',
                        rightText: '',
                        list:[
                            { show:true, field:'sfcjjbaqpx', zdv:'shifou', title:'是否参加基本安全培训', value:'' },
                            { show:true, field:'zcgwzs', zdv:'', title:'职称/岗位证书', value:'' },
                            { show:true, field:'jnspdj', zdv:'', title:'技能水平/等级', value:'' },
                            { show:true, field:'hyzk', zdv:'hyzk-cxcj', title:'婚姻状况', value:'' },
                            { show:true, field:'zzmm', zdv:'zzmm', title:'政治面貌', value:'' },
                            { show:true, field:'sfjrgh', zdv:'shifou', title:'是否加入工会', value:'' },
                            { show:false, field:'jrghsj', zdv:'', title:'加入工会时间', value:'', },
                            { show:true, field:'sfyzdjbs', zdv:'shifou', title:'是否有重大疾病史', value:'' },
                            { show:true, field:'jjlxrxm', zdv:'', title:'紧急联系人姓名', value:'' },
                            { show:true, field:'jjlxdh', zdv:'', title:'紧急联系人电话', value:'' }
                        ]
                    },
                },
                // 进场
                enter:{
                    enterTime: '', // 进场时间
                    staffs:[]
                },

                // 补卡
                buka:{
                    result: null, // 补卡详情
                    memberInfo: { // 补卡人员信息
                        xm: '', // xm
                        list :[
                            { field:'zjhm', span:7, title:'证件号码', value:'安薪乐' },
                            { field:'districtName', span:5, title:'所属区划', value:'安薪乐' },
                            { field:'gcmc', span:12, title:'项目名称', value:'安薪乐' },
                            { field:'bzmc', span:7, title:'班组名称', value:'安薪乐' },
                            { field:'jsgz', span:5, title:'从事工种', value:'安薪乐' }, 
                        ]
                    },  
                    time: '1970-01-01',
                    reason: '我是补卡原因',
                },
    
                // 审批意见
                reason: '',

                // 审核结果
                result:{
                    line: false,
                    title: '审核结果',
                    rightText: '',
                    list:[
                        { field:'shyj', title:'审批意见', value:'安薪乐' },
                        { field:'shry', title:'审批人', value:'安薪乐' },
                        { field:'shsj', title:'审批时间', value:'安薪乐', },
                        { field:'shjg', title:'审批状态', value:'安薪乐', },
                    ]
                },

                // 附件
                accessoryList: [], 
			}
		},

		onLoad(option) {
            this.status = option.status
            this.type = option.type
            this.id = option.id

            switch (option.type) {
                case 'team':
                    this.title = '新增班组信息'
                    this.detailApi = this.$apis.addGroupDetail // 详情API
                    this.auditApi = this.$apis.addGroupExamine // 审核API
                    this.teamDetail()
                    this.getAccessoryList('salary_smzgl_xmbz',this.id)
                    break;
                case 'leave':
                    this.title = '人员离场审批'
                    this.detailApi = this.$apis.leaveLookDetail // 详情API
                    this.auditApi = this.$apis.leaveAudit  // 审核API
                    this.leaveDetail() 
                    this.leaveStaffList()
                    this.getAccessoryList('salary_smzgl_rylc',this.id)
                    break;
                case 'transfer':
                    this.title = '人员调岗审批'
                    this.detailApi = this.$apis.memberTransferDetail // 详情API
                    this.auditApi = this.$apis.memberTransferAudit // 审核API
                    this.transferDetail()
                    this.getTransferStaffList()
                    this.getAccessoryList('salary_smzgl_modifygroup',this.id)
                    break;
                case 'foreman':
                    this.title = '班组长变更审批'
                    this.detailApi = this.$apis.groupChangeDetail // 详情API
                    this.auditApi = this.$apis.groupChangeAudit // 审核API
                    this.foremanDetail()
                    this.getAccessoryList('salary_bzz_change',this.id)
                    break;

                case 'autonym':
                    this.title = '工人信息采集'
                    this.detailApi = this.$apis.autonymDetail // 详情API
                    this.auditApi = this.$apis.autonymAudit // 审核API
                    this.autonymDetail()
                    this.getAccessoryList('salary_smzgl_ryxx_smrz',this.id)
                    break;
                case 'enter': 
                    this.title = '人员进场审批' 
                    this.detailApi = this.$apis.enterDetail // 详情API
                    this.auditApi = this.$apis.enterAudit // 审核API
                    this.enterDetail()
                    this.enterStaffList()
                    this.getAccessoryList('salary_smzgl_pqxx',this.id)
                    break;

                case 'buka':
                    this.title = '补卡详情'
                    this.detailApi = this.$apis.makeCardDetail // 详情API
                    this.auditApi = this.$apis.makeCardAudit // 审核API
                    this.bukaDetail()
                    break;
            }
        },

		methods: {
            // 返回
            back(){
                uni.navigateBack()
            },

            // 班组详情
            teamDetail(){
                this.$request(this,this.detailApi,{id:this.id}).then(res=>{
                    this.teamInfo.list.map((v,i)=>{
                        v.value = res[v.field]?res[v.field]:'暂无数据源'
                    })
                    // 审核结果
                    this.disposeAuditResult(res)
                }).then()
            },
            
            // 人员离场详情
            leaveDetail(){
                const api = JSON.parse(JSON.stringify(this.detailApi))
                api.url+=this.id
                this.$request('this',api,{}).then(res=>{
                    console.log('人员离场详情',res)
                    this.leave.auditPar = res
                    this.leave.lcsj =  this.$moment(res.lcsj).format('YYYY-MM-DD HH:mm')
                    this.leave.sgxkbh = res.sgxkbh
                    // 审核结果
                    this.disposeAuditResult(res)
                })
            },
            // 人员离场列表
            leaveStaffList(){
                const pra = {
                    searchTerminal: "PC",
                    filter1: 'notDeptId',
                    ywbh: this.id
                }
                this.$request(this,this.$apis.memberLeaveDeatilList,pra).then(res=>{
                    const { rows } = res
                    rows.map((v,i)=>{
                        v.gcmc = this.userInfo.ssgcmc
                        v.xmmc = this.userInfo.ssqymc
                        v.isUnfold = true // 展开
                        v.showBtn = false // 异常移出等操作
                    })
                    this.leave.staffs = rows
                })
            },

            // 调岗详情
            transferDetail(){
                this.$request(this,this.detailApi,{id:this.id}).then(res=>{
                    console.log('调岗详情',res)
                    this.transfer.teamData = {
                        bzmc: res.groupname,
                        qymc: res.deptName, 
                        bzzxm: res.groupleadername,
                        bzzlxdh: res.groupleaderphone,
                        cyrs: res.cyrs,
                    }
                    // 审核结果
                    this.disposeAuditResult(res)
                }).then()
            },
            // 调岗---人员列表
            getTransferStaffList(){
                this.$request(this,this.$apis.memberTransferMemberList,{modifygroupid:this.id}).then(res=>{
                    // console.log('人员列表',res)
                    this.transfer.staffList = []
                    res.map((v,i)=>{
                        const temporaryData = JSON.parse(JSON.stringify(this.transfer.staffItem)) 
                        temporaryData.map((a,b)=>{
                            if( a.field == 'isleader' ){
                                a.value = v[a.field]==1?'是':'否'
                            }else if(a.field == 'idcard'){
                                a.value = this.$tools.formatIdentity(v[a.field])
                            }else if(a.field == '_status'){
                                a.value = v.taggroupname?'已变更':'未变更'
                            }else{
                                a.value = v[a.field]?v[a.field]:'暂无数据源'
                            }
                        })
                        this.transfer.staffList.push(temporaryData)
                    })
                })
            },

            // 班组长变更
            foremanDetail() {
                this.$request(this, this.detailApi, { id: this.id }).then(res => {
                    console.log('班组长变更详情', res)
                    this.foreman.baseInfo = { 
                        bzmc: res.xmbz.bzmc,
                        qymc: res.xmbz.deptName,
                        bzzxm: res.xmbz.bzzxm,
                        bzzlxdh: res.xmbz.bzzlxdh,
                        cyrs: res.xmbz.cyrs,
                    }
                    const test = [
                        { field: 'bzzbh' , title:'id', value:'' },
                        { field: 'bzzxm' , title:'xm', value:'' },
                        { field: 'bzzxb' , title:'xb', value:'' },
                        { field: 'bzzlxfs' , title:'lxfs', value:'' },
                        { field: 'bzzzjhm' , title:'zjhm', value:'' },
                        { field: 'bzzzjlx' , title:'zjlx', value:'' },
                    ]
                    res.hisChange.map((v,i)=>{
                        test.map((a,b)=>{
                            if( v.bgzd == a.field ) a.value = v.bgh
                        })
                    })
                    this.foreman.changeInfo = {
                        id: test[0].value,
                        xm: test[1].value,
                        xb: test[2].value,
                        lxfs: test[3].value,
                        zjhm: test[4].value,
                        zjlx: test[5].value,
                    }
                    this.foreman.bz = res.bz 
                    // 审核结果??
                    this.disposeAuditResult(res.xmbz)
                }).then()
            },



            // 实名认证
            autonymDetail(){
                this.$request(this,this.detailApi,{id:this.id}).then(res=>{
                    if( res.sfcjjbaqpx ){
                        res.sfcjjbaqpx = '1'
                    }else{
                        res.sfcjjbaqpx = '0'
                    }
                    // console.log('实名认证详情',res)
                    // 实名制信息,合同信息,工资卡信息,其它信息
                    const types = ['info','contractInfo','paycardInfo','otherInfo']
                    types.map((a,b)=>{
                        this.autonym[a].list.map((v,i)=>{
                            if( v.zdv && res[v.field] ){
                                this.getCommonDictTran(v.zdv,res[v.field],v)
                            }else{
                                v.value = res[v.field]?res[v.field]:'暂无数据源'
                            }
                        })
                    })
                    // 判断某些字段的显示与隐藏
                    if( res.sflwht == 0 ){ // 未签署合同
                        this.autonym.contractInfo.list.map((v,i)=>{
                            if( i != 0 ) v.show = false
                        })
                    }
                    if( res.gzklb == 1 ){ // 社会保障卡
                        this.autonym.paycardInfo.list.map((v,i)=>{
                            if( v.field=='khhyh' || v.field=='khhdm' || v.field=='gzkkh' ) v.show = false
                            if( v.field=='sbkkh' ) v.show = true
                        })
                    }else if( res.gzklb == 2){ // 银行卡
                        this.autonym.paycardInfo.list.map((v,i)=>{
                            if( v.field=='khhyh'|| v.field=='khhdm' || v.field=='gzkkh' ) v.show = true
                            if( v.field=='sbkkh' ) v.show = false
                        })
                    }else{
                        this.autonym.paycardInfo.list.map((v,i)=>{
                            if( i!=0 ) v.show = false
                        })
                    }
                    if( res.sfjrgh == 1 ){ // 加入了工会
                        let a = this.autonym.otherInfo.list.filter(e=>{ return e.field == 'jrghsj' })
                        a[0].show = true
                    }
                    // 审核结果
                    this.disposeAuditResult(res)
                }).then()
            },

            // 进场详情
            enterDetail(){
                const api = JSON.parse(JSON.stringify(this.detailApi))
                api.url += this.id
                this.$request('this',api).then(res=>{
                    // console.log('进场详情',res)
                    this.enter.enterTime = res.createTime
                    // 审核结果
                    this.disposeAuditResult(res)
                })
            },
            // 进场人员列表
            enterStaffList(){
                const pra = {
                    searchTerminal: "PC",
                    pqid: this.id
                }
                this.$request(this,this.$apis.enterStaffDetailList,pra).then(res=>{
                    const { rows } = res
                    const arr = []
                    rows.map((a,b)=>{
                        const tem = [
                            { field:'xm', title:'姓名', span:6, value:'' },
                            { field:'deptName', title:'所属单位', span:12, value:'' },
                            { field:'zjhm', title:'证件号码', span:12, value: '513022202101011234'  },
                            { field:'lxfs', title:'联系电话', span:6, value: '18302882468',type:'phone'  },
                        ]
                        tem.map((v,i)=>{
                            v.value = a[v.field]
                        })
                        arr.push(tem)
                    })
                    this.enter.staffs = arr
                })
            },



            // 补卡详情
            bukaDetail(){
                const api = JSON.parse(JSON.stringify(this.detailApi))
                api.url+=this.id
                this.$request(this,api).then(res=>{
                    // console.log('补卡详情',res)
                    // 人员
                    this.buka.result = res
                    this.buka.memberInfo.xm = res.xm
                    this.buka.memberInfo.list.map((v,i)=>{
                        v.value = res[v.field]?res[v.field]:'暂无数据源'
                    })
                    // 补卡时间&理由
                    this.buka.time = res.bksj
                    this.buka.reason = res.bkyy
                    // 审核结果
                    this.disposeAuditResult(res)
                })
            },



            // 审核结果
            disposeAuditResult(res){
                this.result.list.map((v,i)=>{
                    if( v.field == 'shjg' ){
                        v.value = res[v.field]==1?'同意':res[v.field]==0?'拒绝':'办理中'
                    }else{
                        v.value = res[v.field]?res[v.field]:'暂无数据源'
                    }
                })
            },



            // 获取附件列表
            getAccessoryList(ywlx,ywbh){
                this.$request('this',this.$apis.MemberAtta,{ywlx:ywlx,ywbh:ywbh}).then(res=>{
                    this.accessoryList = res
                })
            },



            // 审批按钮操作
            btnFn(type){
                if( type == 2 ) uni.navigateBack() // 返回
                if( type == 1 ) this.examine(1) // 通过
                if( type == 0 ) this.examine(0) // 拒绝
            },
            // 审核
            examine(shjg){
                let baseParameter = {
                    id: this.id, // 业务id
                    shjg: shjg, // 审核结果（通过=1,不通过=0）
                    shyj: shjg == 1 ? this.reason ? this.reason : '审核通过' : this.reason, // 审核意见
                    shry: this.userInfo.acc+'['+this.userInfo.userName+']', // 审核人员 acc+'['+userName+']' (账号+'['+昵称+']')
                    shsj: this.$moment().format('YYYY-MM-DD HH:mm:ss')  // 审核时间
                }
                let parameter = {}
                switch ( this.type ) {
                    case 'leave':
                        parameter = Object.assign(this.leave.auditPar,baseParameter)
                        break;
                    case 'buka':
                        parameter = Object.assign(this.buka.result,baseParameter)
                        break;
                    default:
                        parameter = baseParameter
                        break;
                }
                // 拒绝时审核意见为必填项
                if( !shjg && !parameter.shyj ){
                    uni.$u.toast( '请填写拒绝原因' )
                    return false
                }
                uni.showLoading({ title:'审核中' })
                this.$request(this,this.auditApi,parameter).then(res=>{
                    uni.navigateBack()
                }).then()
            },



            // 字典值转译
            getCommonDictTran(dictType,dictValue,v){
                this.$request(this,this.$apis.CommonDictTran,{dictType:dictType,dictValue:dictValue}).then(res=>{
                    if( typeof(res)=='string' ){
                        v.value = res
                    }else{
                        v.value = '字典值转译值为null'
                    }
                })
            },
		}
	}
</script>

<style scoped lang="scss">
    .content{
        .item{
            background: $uni-text-color-inverse;
            box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.07);
        }
    }
</style>
